package com.ll.ycdy;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
public class YcdyApplication {

	public static void main(String[] args) {
		SpringApplication.run(YcdyApplication.class, args);
	}

	@Bean
	public RestTemplate restTemplate(RestTemplateBuilder builder) {
		return builder.build();
	}

	@Bean
	public CommandLineRunner run(RestTemplate restTemplate) throws Exception {
		return args -> {
			String info = restTemplate.getForObject("http://localhost:8080/order/getXml", String.class);
			System.out.println(info);

			info = restTemplate.getForObject("http://localhost:8080/coffee/", String.class);
			System.out.println(info);


		};
	}

}
